package java_thinking.unit_16;
/**
 * @author: cww
 * @DateTime: 2019-04-09 20:12
 */

public class E11_AutoboxingWithArrays {

    public static void main(String[] args) {
        int[] pa = {1,2,3,4,5};
        //无法编译
        //! Integer[] wa = pa;
        /**
         * 下面这个Integer数组在创建的时候实际上编译器做了一件转型
         *  Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;这是反编译后的代码片段
         */
         Integer[] wb = {1,2,3,4,5};
        //! int[] pb = wb;
    }
}

/**

 * Compiled from "E11_AutoboxingWithArrays.java"
 * public class E11_AutoboxingWithArrays {
 *   public E11_AutoboxingWithArrays();
 *     Code:
 *        0: aload_0
 *        1: invokespecial #1                  // Method java/lang/Object."<init>":()V
 *        4: return
 *
 *   public static void maindemo(java.lang.String[]);
 *     Code:
 *        0: iconst_5
 *        1: newarray       int
 *        3: dup
 *        4: iconst_0
 *        5: iconst_1
 *        6: iastore
 *        7: dup
 *        8: iconst_1
 *        9: iconst_2
 *       10: iastore
 *       11: dup
 *       12: iconst_2
 *       13: iconst_3
 *       14: iastore
 *       15: dup
 *       16: iconst_3
 *       17: iconst_4
 *       18: iastore
 *       19: dup
 *       20: iconst_4
 *       21: iconst_5
 *       22: iastore
 *       23: astore_1
 *       24: iconst_5
 *       25: anewarray     #2                  // class java/lang/Integer
 *       28: dup
 *       29: iconst_0
 *       30: iconst_1
 *       31: invokestatic  #3                  // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
 *       34: aastore
 *       35: dup
 *       36: iconst_1
 *       37: iconst_2
 *       38: invokestatic  #3                  // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
 *       41: aastore
 *       42: dup
 *       43: iconst_2
 *       44: iconst_3
 *       45: invokestatic  #3                  // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
 *       48: aastore
 *       49: dup
 *       50: iconst_3
 *       51: iconst_4
 *       52: invokestatic  #3                  // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
 *       55: aastore
 *       56: dup
 *       57: iconst_4
 *       58: iconst_5
 *       59: invokestatic  #3                  // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
 *       62: aastore
 *       63: astore_2
 *       64: return
 * }
 */
